<template>
  <div class="main-container">
    <!-- 公共头部 -->
    <header id="header">
      <section class="container">
        <h1 id="logo">
          <router-link to="/" title="支付案例">
            支付案例
          </router-link>
        </h1>
        <div>
          <ul class="nav">
            <router-link to="/home/course" custom v-slot="{ navigate, isActive }">
              <li :class="['nav-item', { current: isActive }]" @click="navigate">
                <a>购买课程</a>
              </li>
            </router-link>
            <router-link to="/home/order" custom v-slot="{ navigate, isActive }">
              <li :class="['nav-item', { current: isActive }]" @click="navigate">
                <a>我的订单</a>
              </li>
            </router-link>
            <router-link to="/home/download" custom v-slot="{ navigate, isActive }">
              <li :class="['nav-item', { current: isActive }]" @click="navigate">
                <a>下载账单</a>
              </li>
            </router-link>
          </ul>
        </div>
        <div class="clear"></div>
      </section>
    </header>

    <!-- 主要内容区域 -->
    <main class="main-content">
      <router-view></router-view>
    </main>
  </div>
</template>

<script setup>

</script>

<style scoped>
/* 公共头部样式 */
#header {
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 100;
}

.container {
  width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#logo {
  width: 150px;
}

.nav {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-item {
  margin: 0 15px;
  position: relative;
  cursor: pointer;
}

.nav-item a {
  color: #333;
  text-decoration: none;
  font-size: 16px;
  padding: 10px 0;
  display: block;
}

.nav-item.current a,
.nav-item:hover a {
  color: #409EFF;
}

.nav-item.current::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: #409EFF;
}

.clear {
  clear: both;
}

/* 主要内容区域 */
.main-content {
  min-height: calc(100vh - 120px - 200px);
  /* 视口高度 - 头部高度 - 底部高度 */
  padding: 20px 0;
}
</style>